<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML>
<html lang="zh-CN">
  <head>
    <base href="<%=basePath%>">
    
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    
    <title>设计云注册</title>
    
	<jsp:include page="../common/common.jsp"></jsp:include>
	<link rel="stylesheet" href="<%=request.getContextPath() %>/resources/js/mybootstrap/css/bootstrap.css" />
	<link href="<%=request.getContextPath() %>/resources/css/system/index/common.css" rel="stylesheet"></link>
	<link href="<%=request.getContextPath() %>/resources/css/system/index/login.css" rel="stylesheet"></link>
 
    
  </head>
  
  <body class="indexBody">
  	<div class="indexBox">
  		<form class="indexForm registerForm" id="registerForm">
  			<div class="index-title">注册页面</div>
  			
  			<div class="reg-identity clearfix">
  				<div id="reg-person" class="reg-idLeft idActive">设计个人</div>
  				<div id="reg-firm" class="reg-idRight">设计公司</div>
  				<input id="type" type="hidden" name="type" value="1"/>
  			</div>
  			
			<div class="list-box">
				<div class="list-tr">
					<input type="text" name="phone" id="phone" placeholder="用户名/手机号" onblur="uniquePhoneVerify('phone','phone')"/>
				</div>
				<div class="list-tr">
					<input type="hidden" name="password" id="password">
					<input type="password" name="pwd" id="pwd" placeholder="密码" />
				</div>
				<div class="list-tr2">
					<input type="text" name="VBR" id="VBR" placeholder="动态码" />
					<a class="a-white btn1" id="mobileCode" href="javascript:;">获取动态码</a>
				</div>
			</div>
			
			<div class="handle-bar">
				<div class="rememberPass">
					<input name="" type="checkbox" value="" id="termsSure" checked="checked">
					<a class="a-black" href="javascript:;">会员协议</a>
				</div>
			</div>
			
			<div class="foot-box btn1" id="registerSure">
				<a class="foot-butten a-white" href="javascript:;">注册</a>
			</div>
			
			<div class="error-resgister">
				<span id="errorContent"></span><!-- 错误提示 -->
			</div>
			
			<div class="bottom-bar">
				<div class="bottom-line"></div>
				<a class="bottom-btn" href="before/login">立即登录</a>
			</div>
  		</form>
  		
  		<div id="copyrightPageBox"></div>
  	</div>
  	
  	<script src="<%=request.getContextPath() %>/resources/js/jquery/1.12.4/jquery.min.js"></script>
  	<script src="<%=request.getContextPath() %>/resources/js/system/index/copyright.js"></script>
  	<script src="<%=request.getContextPath() %>/resources/js/system/index/regCode.js"></script>
  	<script src="<%=request.getContextPath() %>/resources/js/system/index/register.js"></script>
  	<script src="<%=request.getContextPath() %>/resources/js/system/index/Cookies.js"></script>
  	<script src="<%=request.getContextPath() %>/resources/js/system/index/jquery.md5.js"></script>
  	<script type="text/javascript">
  		//检查短信验证码
		function checkRegisterStep1(){  
	     	$.ajax({
       			type:'post',
           		url:CONTEXT_PATH+'before/register/dynamiccodeVerify',
           		data:{'dynamiccode':$('#VBR').val(),phone:$('#phone').val()},
           		success:function(data){
                   
                   if(data.flag==false){
                      RemainTime();
                      alert(data.message); 
                   }else{
                   	  //md5加密传输
	            	  $("#password").val($.md5($("#pwd").val()));
                      $.ajax({
                      	cache: true,
						type: 'post',
						url: CONTEXT_PATH+'before/register/save_register',
						data: $("#registerForm").serialize(),
						async: false,
						success: function(data) {  
				                if(data==true){
				                	$.ajax({
							 			type: 'post',
						     			url: '<%=basePath%>before/login', 
							 			data:  {phone:$("#phone").val(),password:$("#pwd").val()},
							 			dataType: 'json',
							 			success: function(data) {  
				                			if(data.result){
				                	    			window.location.href='<%=basePath%>front/carDesign/carDesign_list';
				                			}else{
 			                    			}

				            			}
							
									});
				                }else{
				                	alert("注册失败");
 			                    }

				            }
						});
                   }	            
           		}
      		});   
		}
		
		function idToggle(){
			$("#reg-person").click(function(){
				$(this).addClass("idActive");
				$("#reg-firm").removeClass("idActive");
				$("#type").val(1);//设计个人为1;设计公司为2
			});
			$("#reg-firm").click(function(){
				$(this).addClass("idActive");
				$("#reg-person").removeClass("idActive");
				$("#type").val(2);
			});
		}
		
</script>
    
  </body>
</html>
